package com.leyou.trade.dto;

import com.leyou.common.dto.BaseDTO;
import com.leyou.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.leyou.common.dto.BaseDTO;
import com.leyou.common.entity.BaseEntity;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

@EqualsAndHashCode(callSuper = true)
@Data
public class OrderDetailDTO  extends BaseDTO {

    private Integer num;
    private String title;
    @JsonIgnore
    private Long orderId;
    private Long price;
    @JsonRawValue
    private String spec;
    private String image;

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getPrice() {
        return price;
    }

    public void setPrice(Long price) {
        this.price = price;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public OrderDetailDTO(BaseEntity entity) {
        super(entity);
    }

    public static <T extends BaseEntity> List<OrderDetailDTO> convertEntityList(Collection<T> list) {
        if (list == null) return Collections.emptyList();
        return list.stream().map(OrderDetailDTO::new).collect(Collectors.toList());
    }
}
